# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer
pkgname=pcc
pkgver=20191221
pkgrel=0
pkgdesc="The portable C compiler."
url="http://pcc.ludd.ltu.se/"
arch="x86 x86_64"
license="BSD"
depends="pcc-libs-dev>=$pkgver-r0"
depends_dev=""
makedepends="byacc flex"
install=""
subpackages="$pkgname-doc"
source="ftp://pcc.ludd.ltu.se/pub/$pkgname/$pkgname-$pkgver.tgz"

builddir="$srcdir/"$pkgname-$pkgver
prepare() {
	default_prepare

	cd "$builddir"
	update_config_sub

	sed -i -e 's/AC_CHECK_PROG(strip,strip,yes,no)//' \
		configure.ac
	sed -i -e 's/AC_SUBST(strip)//' \
		configure.ac
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-stripping
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	# Don't conflict with gcc-doc.
	mv "$pkgdir"/usr/share/man/man1/cpp.1 \
		"$pkgdir"/usr/share/man/man1/$pkgname-cpp.1
}

sha512sums="d8ecd9062959c926186fe44e86b126b12c7d41e7252acf71e9a59a4b2f013b308f5d37ed77524b124287afa380618a88cd19fe48807bcda08994a2aaf403ee5d  pcc-20191221.tgz"
